package cz.cvut.fit.mi.dpo.mvc;

import cz.cvut.fit.mi.dpo.mvc.controller.Controller;
import cz.cvut.fit.mi.dpo.mvc.model.Service;
import cz.cvut.fit.mi.dpo.mvc.view.View;
import cz.cvut.fit.mi.dpo.mvc.view.Window;

import javax.swing.*;

/**
 * @author David Pertl
 * @author Martin Štekl <steklmar@fit.cvut.cz>
 */
public class Main {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}

		Service model = new Service();
		Controller controller = new Controller(model);

		View view = new View(controller, model);

		model.addModelChangedListener(view);
		controller.setView(view);

		Window window = new Window(view);
		controller.setMessageWriter(window);
	}

}
